package org.ruoyi.ppt.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.ruoyi.ppt.domain.PptImage;

import java.util.List;

/**
 *
 *
 * @author anran
 * @date 2025/9/30/周二 16:02
 */
@Mapper
public interface PptImageMapper extends BaseMapper<PptImage> {
    /**
     * 批量插入图片数据
     */
    @Insert("<script>" +
            "INSERT INTO ppt_images (ppt_id, image_url, upload_time) VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.pptId}, #{item.imageUrl}, #{item.uploadTime})" +
            "</foreach>" +
            "</script>")
    int insertBatchSomeColumn(@Param("list") List<PptImage> list);

    /**
     * 使用JDBC批量插入
     */
    @Insert("<script>" +
            "INSERT INTO ppt_images (ppt_id, image_url, upload_time) " +
            "VALUES " +
            "<foreach collection='imageList' item='item' separator=','>" +
            "(#{item.pptId}, #{item.imageUrl}, #{item.uploadTime})" +
            "</foreach>" +
            "</script>")
    void batchInsertImages(@Param("imageList") List<PptImage> imageList);
}
